﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameCore;
using GameObject;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace ResourceManager
{
    public class ButtonManager : EntityManager
    {
        public override void InitPrototype()
        {
            string[] strsource = ResourceDefine.Button_stresource;// { "button_normal","button_hover","button_click"};

            _nprototype = ResourceDefine.Button_textdefine.Count<string>() ;
            _prototype = new Button[_nprototype];

            for (int i = 0; i < _nprototype; i++)
            {
                _prototype[i] = new Button();
                ((Button)_prototype[i]).Init(1,strsource,ResourceDefine.Button_textdefine[i],GlobalDefine.Content.Load<SpriteFont>(@"Font\Arial"));
            }
        }

        public override VisibleGameObject CreateObject(int index)
        {
            if ((index < 0) || (index >= _nprototype))
            {
                return null;
            }
            return _prototype[index].Clone();
        }
    }
}
